package com.pie.face_pie.mapper;

import org.apache.ibatis.annotations.Mapper;

import javax.sql.rowset.serial.SerialBlob;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;

@Mapper
public interface RegisterMapper {
    //查询数据库表中对应grade对应datatime
    public Date getDeadline(String grade);

    public void register(String id, Blob blob);

    public  void check(String id);

    default void  registerWithMaxCapacity(String id, List<InputStream> inputStreams) throws IOException, SQLException {
        check(id);
        for (InputStream file : inputStreams) {
            if (file != null){
                Blob blob = new SerialBlob(file.readAllBytes());
                register(id,blob);
            }
        }
    }
}
